package chess;

/**
 *
 * @author Dave Frost
 */
public class Rook extends Piece
{
    
    public Rook(int color)
    {
        pieceColor = color;
    }//end of constructor
    
    public int canMove(int sourceX, int sourceY, int destX, int destY)
    {
        // Return false if coordinates are outside of the board.
        if(sourceX < 0 || sourceX > 7 || sourceY < 0 || sourceY > 7 ||
                destX < 0 || destX > 7 || destY < 0 || destY > 7)
            return 0;
        
        if(sourceX == destX && sourceY != destY) 
        // Piece is moving vertically but not horizontally
        {
            return 1;
        }
        if(sourceX != destX && sourceY == destY)
            // Piece is moving horizontally but not vertically
        {
                return 1;
        }  
        return 0;   
       
    }//end of canMove
    
    public char getType()
    {
        return 'R';
    }//end of getType
    
    public static int getValue()
    {
        return 5;
    }//end of getValue
    
    
}//end of Rook

